from manimlib import *

def corner2rect(p1: np.ndarray, p2: np.ndarray, **kwargs) -> Rectangle:
    ul = np.array([min(v1, v2) for v1, v2 in zip(p1, p2)])
    dr = np.array([max(v1, v2) for v1, v2 in zip(p1, p2)])
    return Rectangle(*(dr - ul)[:2], **kwargs).move_to((dr + ul) / 2)

def surcamera(buff=0, **kwargs) -> Rectangle:
    return Rectangle(FRAME_WIDTH + 2 * buff, FRAME_HEIGHT + 2 * buff, **kwargs)

def simple_sum(m1: VMobject, m2: VMobject, **kwargs) -> VMobject:
    res = VMobject(**kwargs)
    res.append_points(m1.get_points())
    res.append_points(m2.get_points())
    return res

def simple_sub(m1: VMobject, m2: VMobject, **kwargs) -> VMobject:
    res = VMobject(**kwargs)
    res.append_points(m1.get_points())
    res.append_points(m2.get_points()[::-1])
    return res
